package com.alks.function.data.vo.finance.lotcost.h5;

import com.alks.common.utils.BigDecimalUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

/**
 * @author: chen
 * @date: 2025/2/10
 * @description: 成本统计移动端VO
 */
@Data
@ApiModel(value = "成本统计移动端VO")
public class LotCostAnalysisStatisticH5VO {

    @ApiModelProperty(value = "指令")
    private String lotNo;

    @ApiModelProperty(value = "指令成本")
    private BigDecimal costAmt;

    @ApiModelProperty(value = "面材")
    private BigDecimal upperMtl;

    @ApiModelProperty(value = "面材占比")
    private String upperMtlPer;

    @ApiModelProperty(value = "包材")
    private BigDecimal packMtl;

    @ApiModelProperty(value = "包材占比")
    private String packMtlPer;

    @ApiModelProperty(value = "大底")
    private BigDecimal soleMtl;

    @ApiModelProperty(value = "大底占比")
    private String soleMtlPer;

    @ApiModelProperty(value = "面衬")
    private BigDecimal soleMtl2;

    @ApiModelProperty(value = "面衬占比")
    private String soleMtl2Per;

    @ApiModelProperty(value = "冲裁")
    private BigDecimal cutLabor;

    @ApiModelProperty(value = "冲裁占比")
    private String cutLaborPer;

    @ApiModelProperty(value = "手工")
    private BigDecimal processLabor;

    @ApiModelProperty(value = "手动占比")
    private String processLaborPer;

    @ApiModelProperty(value = "外协")
    private BigDecimal outLabor;

    @ApiModelProperty(value = "外协占比")
    private String outLaborPer;

    @ApiModelProperty(value = "针车")
    private BigDecimal stitchLabor;

    @ApiModelProperty(value = "针车占比")
    private String stitchLaborPer;

    @ApiModelProperty(value = "成型")
    private BigDecimal lastLabor;

    @ApiModelProperty(value = "成型占比")
    private String lastLaborPer;

    @ApiModelProperty(value = "水电")
    private BigDecimal powerFee;

    @ApiModelProperty(value = "水电占比")
    private String powerFeePer;

    @ApiModelProperty(value = "管理")
    private BigDecimal adminFee;

    @ApiModelProperty(value = "管理占比")
    private String adminFeePer;

    @ApiModelProperty(value = "补单")
    private BigDecimal supplementFee2;

    @ApiModelProperty(value = "补单占比")
    private String supplementFee2Per;

    @ApiModelProperty(value = "其他")
    private BigDecimal otherFee;

    @ApiModelProperty(value = "其他占比")
    private String otherFeePer;

    @ApiModelProperty(value = "料")
    private BigDecimal mtl;

    @ApiModelProperty(value = "料占比")
    private String mtlPer;

    @ApiModelProperty(value = "工")
    private BigDecimal labor;

    @ApiModelProperty(value = "工占比")
    private String laborPer;

    @ApiModelProperty(value = "费")
    private BigDecimal fee;

    @ApiModelProperty(value = "费占比")
    private String feePer;

    public BigDecimal getCostAmt() {
        return BigDecimalUtil.numberScale(
                BigDecimalUtil.sum(this.upperMtl, this.packMtl, this.soleMtl, this.soleMtl2,
                        this.cutLabor, this.processLabor, this.outLabor, this.stitchLabor, this.lastLabor,
                        this.powerFee, this.adminFee, this.supplementFee2, this.otherFee), 3);
    }

    public String getUpperMtlPer() {
        return BigDecimalUtil.percent(this.upperMtl, getCostAmt(), 0);
    }

    public String getPackMtlPer() {
        return BigDecimalUtil.percent(this.packMtl, getCostAmt(), 0);
    }

    public String getSoleMtlPer() {
        return BigDecimalUtil.percent(this.soleMtl, getCostAmt(), 0);
    }

    public String getSoleMtl2Per() {
        return BigDecimalUtil.percent(this.soleMtl2, getCostAmt(), 0);
    }

    public String getCutLaborPer() {
        return BigDecimalUtil.percent(this.cutLabor, getCostAmt(), 0);
    }

    public String getProcessLaborPer() {
        return BigDecimalUtil.percent(this.processLabor, getCostAmt(), 0);
    }

    public String getOutLaborPer() {
        return BigDecimalUtil.percent(this.outLabor, getCostAmt(), 0);
    }

    public String getStitchLaborPer() {
        return BigDecimalUtil.percent(this.stitchLabor, getCostAmt(), 0);
    }

    public String getLastLaborPer() {
        return BigDecimalUtil.percent(this.lastLabor, getCostAmt(), 0);
    }

    public String getPowerFeePer() {
        return BigDecimalUtil.percent(this.powerFee, getCostAmt(), 0);
    }

    public String getAdminFeePer() {
        return BigDecimalUtil.percent(this.adminFee, getCostAmt(), 0);
    }

    public String getSupplementFee2Per() {
        return BigDecimalUtil.percent(this.supplementFee2, getCostAmt(), 0);
    }

    public String getOtherFeePer() {
        return BigDecimalUtil.percent(this.otherFee, getCostAmt(), 0);
    }

    public BigDecimal getMtl() {
        return BigDecimalUtil.numberScale(
                BigDecimalUtil.sum(this.upperMtl, this.packMtl, this.soleMtl, this.soleMtl2), 3);
    }

    public String getMtlPer() {
        return BigDecimalUtil.percent(getMtl(), getCostAmt(), 0);
    }

    public BigDecimal getLabor() {
        return BigDecimalUtil.numberScale(
                BigDecimalUtil.sum(this.cutLabor, this.processLabor, this.outLabor, this.stitchLabor, this.lastLabor), 3);
    }

    public String getLaborPer() {
        return BigDecimalUtil.percent(getLabor(), getCostAmt(), 0);
    }

    public BigDecimal getFee() {
        return BigDecimalUtil.numberScale(
                BigDecimalUtil.sum(this.powerFee, this.adminFee, this.supplementFee2, this.otherFee), 3);
    }

    public String getFeePer() {
        return BigDecimalUtil.percent(getFee(), getCostAmt(), 0);
    }
}
